
$("#addBookForm").submit(function(event) {
    event.preventDefault();
    var bookTitle = $("#bookTitle").val();
    var bookAuthor = $("#bookAuthor").val();
    var bookPublisher = $("#bookPublisher").val();
    var bookPrice = $("#bookPrice").val();
    var bookData = {
        title: bookTitle,
        author: bookAuthor,
        publisher: bookPublisher,
        price: bookPrice
    };
    $.ajax({
        url: "/bookmanage",
        type: "POST",
        dataType: "json",
        data: JSON.stringify(bookData),
        contentType: "application/json",
        success: function(data) {
            $("#addResult").html("Book added successfully.");
        }
    });
});